"use strict";
var custom = $(".custom"),
    hotRecom = $(".hot-recom"),
    custom_nav = $("#custom-nav"),
    hot_recom_nav = $("#hot-recom-nav");

    custom_nav.click(function () {
        custom_nav.addClass("active");
        hot_recom_nav.removeClass("active");
        custom.removeClass("hide");
        hotRecom.addClass("hide");
    });
    hot_recom_nav.click(function () {
        hot_recom_nav.addClass("active");
        custom_nav.removeClass("active");
        custom.addClass("hide");
        hotRecom.removeClass("hide");
    });
    $(".pass-portrait-hot-recommend li").click(function () {
        $(".pass-portrait-hot-recommend li").removeClass("active");
        $(this).addClass("active");
        $("#pid").val($(this).attr("id"));
        $('#js-big-portrait').attr("src", $(this).find("img").attr("src"));
        $("#js-small-portrait").attr("src", $(this).find("img").attr("src"));
    });

    $('#upload-portrait').change(function(){
        var file = this.files[0];    //选择上传的文件
        var r = new FileReader();
        r.readAsDataURL(file);    //Base64
        $(r).load(function(){
            $('#js-big-portrait').attr("src", this.result);
            $("#js-small-portrait").attr("src", this.result);
        });
    });

var _navbar_collapse = $('.navbar-collapse');
$('.navbar-toggle').click(function () {
    if (_navbar_collapse.hasClass('in')) {
        _navbar_collapse.removeClass('in');
    } else {
        _navbar_collapse.addClass('in');
    }
});